/**
 * @author: 黄聪<cong.huang02@hand-china.com>
 * @since: 2021-08-27 10:52:58
 * @lastTime: 2021-08-27 10:54:25
 * @description:树形组件工具方法
 * @copyright: Copyright (c) 2021, Hand
 */
import Record from "choerodon-ui/pro/lib/data-set/Record";

/**
 * @description:叶节点判断
 * @param {object} param
 * @return {OptionProps} OptionProps
 * 
 *  <TreeSelect
            name='businessUnit'
            async 
            onOption={isLeaf}></TreeSelect>
 */
export function isLeaf({ record }: { record: Record }) {
  const nodeProps = {
    title: record.get("name"),
    isLeaf: false,
  };
  nodeProps.isLeaf = !record.get("hasNext");
  return nodeProps;
}
